package com.hankol.newretail.adapter

import android.widget.ImageView
import android.widget.LinearLayout
import com.baselibrary.utils.OptionUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.hankol.newretail.R
import com.hankol.newretail.adapter.order.MyOrderListAdapter
import com.hankol.newretail.bean.WuliuDataBean

/**
 * @author: 关忆北、
 * @date: 2022/8/9
 * @Des：
 */
class LogisticsAdapter :
    BaseQuickAdapter<WuliuDataBean, BaseViewHolder>(R.layout.item_logistics_order) {
    override fun convert(helper: BaseViewHolder, item: WuliuDataBean) {
        if (helper.adapterPosition == 0) {
            helper.getView<LinearLayout>(R.id.ll_mes_info).alpha = 1f
            OptionUtils.kuaidiStatusIcon(helper.getView<ImageView>(R.id.iv_logistics_site),item.status,true)
            helper.setVisible(R.id.view_dot_top_line, false)
                .setGone(R.id.view_dot_bottom_line, false).setGone(R.id.iv_logistics_site, true)
                .setText(R.id.tv_logistics_title, OptionUtils.kuaidiStatus(item.status))
                .setGone(R.id.tv_logistics_title,true)
                .setText(R.id.tv_logistics_des, item.context)
                .setText(R.id.tv_logistics_time, item.time)
        } else {
            helper.getView<LinearLayout>(R.id.ll_mes_info).alpha = 0.2f
            OptionUtils.kuaidiStatusIcon(helper.getView<ImageView>(R.id.iv_logistics_site),item.status,false)
            helper.setGone(R.id.view_dot_top_line, true)
                .setGone(R.id.view_dot_bottom_line, data[helper.adapterPosition-1].status==item.status)
                .setText(R.id.tv_logistics_title, OptionUtils.kuaidiStatus(item.status))
                .setText(R.id.tv_logistics_des, item.context)
                .setText(R.id.tv_logistics_time, item.time)
                .setGone(R.id.tv_logistics_title,data[helper.adapterPosition-1].status!=item.status)
                .setGone(R.id.iv_logistics_site,data[helper.adapterPosition-1].status!=item.status)
                .setGone(R.id.ll_bottom_line,helper.adapterPosition!=data.size-1)
        }
    }
}